﻿using System.Windows;
using System.Windows.Controls;

namespace WPFTestSolution.Pages.Controls.ContentControls.ButtonBases.ToggleButtons {
    
    /**
     * https://www.bilibili.com/video/BV1bV411A7Eq?p=33
     * 033-RadioButton单选框
     * https://www.wpfsoft.com/2023/08/23/1267.html
     *
     * RadioButton也继承于ToggleButton，作用是单项选择，所以被称为单选框。
     * 本质上，它依然是一个按钮，一旦被选中，不会清除，除非它”旁边“的单选框被选中。
     *
     * 属性:
     * GroupName: 分组名称。默认值是一个空字符串。用来指定哪些RadioButton之间是互相排斥的
     */
    public partial class _33_RadioButton_Page : Page {
        public _33_RadioButton_Page() {
            InitializeComponent();
            this.Title = "033-RadioButton单选框";
        }

        private void _button_Click(object sender, RoutedEventArgs e) {
            string order = string.Empty;
            if (this._RadioButton0.IsChecked == true) {
                order += this._RadioButton0.Content + ", ";
            }
            if (this._RadioButton1.IsChecked == true) {
                order += this._RadioButton1.Content + ", ";
            }
            if (this._RadioButton2.IsChecked == true) {
                order += this._RadioButton2.Content + ", ";
            }
            if (this._RadioButton3.IsChecked == true) {
                order += this._RadioButton3.Content;
            }
            if (this._RadioButton4.IsChecked == true) {
                order += this._RadioButton4.Content;
            }
            // if(!string.IsNullOrEmpty(order))
            MessageBox.Show($"你选择了: {order}");
        }
    }
}